// 跳转合同路由
import { PageRoutesTypeEnum } from 'pub-bbx-global/pageType/dist/enum/PageRoutesEnum';
import { openAccurateTab } from '@src/util/platform';

// 跳转合同新建
export function jumpContractAdd({ id }) {
  let fromId = window.frameElement.getAttribute('id');

  openAccurateTab({
    type: PageRoutesTypeEnum.PageContractCreate,
    params: `contractTemplateId=${id}`,
    reload: true,
    fromId,
  });
}

// 跳转合同编辑
export function jumpContractEdit({ id, templateId }) {
  let fromId = window.frameElement.getAttribute('id');

  openAccurateTab({
    type: PageRoutesTypeEnum.PageContractEdit,
    key: id,
    params: `source=1&contractTemplateId=${templateId}`,
    fromId,
  });
}

// 跳转合同详情页面
export function jumpContractDetail({ id, templateId }) {
  let fromId = window.frameElement.getAttribute('id');

  openAccurateTab({
    type: PageRoutesTypeEnum.PageContractView,
    key: id,
    params: `contractTemplateId=${templateId}`,
    fromId,
  });
}
